﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="CreateTeacher.aspx.cs"
    Inherits="Presentation.Create" MasterPageFile="~/Site.Master" %>

<asp:Content ID="content5" ContentPlaceHolderID="MainContent" runat="server">
 <script type="text/javascript">

     function GotoTeacherListPage() 
     {
         window.location.href = "TeacherList.aspx";

         return false; //stop submit to server
     }

     function Clear() 
     {
         //alert(document.getElementById("TeacherNameBox").value);
         document.getElementById("TeacherNameBox").value = "";
     }

     function Set() 
     {
         if (document.getElementById("TeacherNameBox").value == "") 
         {
             document.getElementById("TeacherNameBox").value = "Please input Name";
         }
     }

     function DropdownlistValidation(source, arguments) 
     {
         //alert(document.getElementById("DropDownListDepartment").value);
          if (document.getElementById("DropDownListDepartment").value == "Please Select"
                ) {
              arguments.IsValid = false;
          } else {
              arguments.IsValid = true;
          }
     }

     function ClientValidation(source, arguments) 
     {
         //alert(document.getElementById("TeacherNameBox").value);
         if (document.getElementById("TeacherNameBox").value == ""
                ) {
             arguments.IsValid = false;
         } else {
             arguments.IsValid = true;
         }
     }

    </script>
    <style type="text/css">
        .distance
        {
            height: 50px;
            width: 150px;
        }
        </style>
      

    <fieldset class="bold" id="CreateTeacher">
        <legend>Teacher</legend>
        <table>
            <tr class="distance">
                <td>
                    Teacher Name
                </td>
                <td>
                    <asp:TextBox ID="TeacherNameBox"   ClientIDMode="Static" runat="server" 
                        onfocus="Clear();" onblur="Set();" ></asp:TextBox>
                </td>
                <td>
               <asp:CustomValidator ID="CustomValidator1" runat="server" ErrorMessage="Teacher Name can not be null" ForeColor="Red"
                    ControlToValidate="TeacherNameBox"  ValidateEmptyText="true" ClientValidationFunction="ClientValidation"></asp:CustomValidator>

                </td>
            </tr>
            <tr class="distance">
                <td>
                    Teacher Gender
                </td>
                <td height="15px">
                    <asp:RadioButtonList ID="RadioButtonList1" runat="server" RepeatDirection="Horizontal">
                        <asp:ListItem Selected="True">Male</asp:ListItem>
                        <asp:ListItem Selected="False">Female</asp:ListItem>
                    </asp:RadioButtonList>
                </td>
            </tr>
            <tr class="distance">
                <td>
                    Department
                </td>
                <td>
                    <asp:DropDownList ID="DropDownListDepartment"  ClientIDMode="Static"  runat="server">
                    </asp:DropDownList>
                </td>
                <td>
                    <asp:CustomValidator ID="CustomValidator2" runat="server" ForeColor="Red" ControlToValidate="DropDownListDepartment"   ClientValidationFunction="DropdownlistValidation"
                        ErrorMessage="Department Name  is not valiate"></asp:CustomValidator>
                </td>
            </tr>
            <tr class="distance">
                <td>
                    <asp:Button ID="Button_Create" runat="server" Text="Create New" OnClick="Button_Create_Click" />
                </td>
                <td>
                <input type="button" value="Cancel" OnClick="GotoTeacherListPage();" />
                </td>
            </tr>
        </table>
    </fieldset>
</asp:Content>
